<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    var each = function (ary ,callback) {
        for(var i = 0,l=ary.length;i<l;i++){
            callback.call(ary[i],i,ary[i]);
        }
    }
    var compare = function (ary1, ary2) {
        if(!ary1.length===ary2.length){
            throw new Error("ary1不等与ary2")
        }
        each(ary1,function (i, n) {
            if(n!==ary2[i]){
                throw new Error('不相等')
            }
            alert('相等')
        })
    }
    compare([1,2,3],[1,2,3])
   console.log((JSON.stringify([1,2,[1,2]])));
</script>
</body>
</html>